package project_package;

import java.util.Calendar;

public class Person {

	int id;
	long datestamp; // class diagram
	long civilNum;
	String name;
	String phoneNo;
	String address;
	
	public Person(int id, String name, String phoneNo, String address, long civilNum)
	{
		long datestamp = System.currentTimeMillis()/1000;
		this.id = id;
		this.datestamp = datestamp;
		this.name = name;
		this.phoneNo = phoneNo; 
		this.address = address;
		this.civilNum = civilNum;
	}
	
	public int getID() 
	{
		return id;
	}
	
	public long getCivilNum()
	{
		return civilNum;
	}
	
	public String getName() 
	{
		return name;
	}
	
	public String getPhoneNo()
	{
		return phoneNo;
	}
	
	public String getAddress() 
	{
		return address;
	}
	
	public long getDatestamp() 
	{
		return datestamp;
	}
	
	public String getDate() 
	{
		// method to transform unix timestamp to normal date
		// example: 1355531526 will return 15.12.2012 01:32
		Calendar memberSince = Calendar.getInstance();
		memberSince.setTimeInMillis(datestamp*1000);
		String since = memberSince.get(Calendar.DAY_OF_MONTH)+"."+memberSince.get(Calendar.MONTH)+"."+memberSince.get(Calendar.YEAR)+" "+memberSince.get(Calendar.HOUR_OF_DAY)+":"+memberSince.get(Calendar.MINUTE);
		return since;
	}
	
	public void setID(int id)
	{
		this.id = id;
	}
	
	public void setCivilNum(long civilNum)
	{
		this.civilNum = civilNum;
	}
	
	public void setName(String name)
	{
		this.name = name;
	}
	
	public void setPhoneNo(String phoneNo)
	{
		this.phoneNo = phoneNo;
	}
	
	public void setAddress(String address)
	{
		this.address = address;
	}
	
	public void setDatestamp(long datestamp) 
	{
		this.datestamp = datestamp;
	}
}